package ch09.shili;

import java.io.*;
import java.util.Arrays;

public class S05_3 {

    public static void main(String[] args) throws IOException {
        //C:\Users\17400\Desktop\images\22.jpg
        //D:\s1db\QQMasterDB.rar
        InputStream fis = new FileInputStream("D:\\s1db\\QQMasterDB.rar");
        OutputStream fos = new FileOutputStream("data\\QQMasterDB.rar");
        System.out.println("可读取的字节数:"+fis.available());
        long start = System.currentTimeMillis();//开始时间
        byte[] arr = new byte[4];
        while (true){
            int count = fis.read(arr);
            if(count == -1){
                break;
            }
//            System.out.println(Arrays.toString(arr) + "\t" + count);
            fos.write(arr,0,count);
            fos.flush();//清空缓冲区
        }
        fis.close();
        fos.close();
        long end = System.currentTimeMillis();//结束时间
        System.out.println("消耗时间(毫秒):"+(end - start));
    }
}
